import Vue from 'vue'
import VueRouter from 'vue-router'

import userData from '@/views/my/childrenRouter/userData'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('../views/layout/index.vue'),
    children: [
      {
        path: '', // 默认子路由
        name: 'home',
        component: () => import('../views/home/index.vue')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('../views/my/index.vue'),
      },
      {
        path: '/company',
        name: 'company',
        component: () => import('../views/company/index.vue')
      },
      {
        path: '/staff',
        name: 'staff',
        component: () => import('../views/staff/index.vue')
      },
    ]
  },
  {
    path: '/my/userData',
    name: 'userData',
    component: userData
  },
  {
    path: '/matron/:matronId',
    name: 'matron',
    component: () => import('../views/home/components/matron.vue'),
    props: true // 开启 Props 传参
  },
]

const router = new VueRouter({
  routes
})

export default router
